﻿Imports System.Data.OleDb
Public Class DataProvider
    Public Shared Function ConnectDB() As OleDbConnection
        Dim connectionString As String
        connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=../../database/QUANLYSOTIETKIEM.mdb"
        Dim conn As New OleDbConnection(connectionString)
        conn.Open()
        Return conn

    End Function
    Public Shared Function KetNoiExcel(ByVal str As String) As OleDbConnection
        'Dim ds1 As New DataTable()
        Dim connectionString As String
        connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + str + ";Extended Properties=""Excel 12.0;HDR=YES"""
        Dim _connection As OleDbConnection = New OleDbConnection(connectionString)
        _connection.Open()
        ' Dim da As OleDbDataAdapter = New OleDbDataAdapter()
        'Dim _command As OleDbCommand = New OleDbCommand()
        '_command.Connection = _connection
        '_command.CommandText = "select * from [Sheet1$B3:G11]"
        'Dim adapter As New OleDbDataAdapter(_command)
        'adapter.Fill(ds1)
        'Return ds1
        Return _connection
    End Function

End Class
